<?php
/**
 * @package    indie-bookstore
 * @subpackage bookstore
 * @author David Neimeyer davidneimeyer@gmail.com
 * administrator/components/com_bookstore/views/locator/tmpl/default.php
 * @link http://indie-bookstore.googlecode.com/
 * @license    GNU/GPL
 * 
 */
 defined('_JEXEC') or die('Restricted access');

$user 	=& JFactory::getUser();

//Ordering allowed ?
$ordering = ($this->lists['order'] == 'a.ordering');

JHTML::_('behavior.tooltip');
?>
<form action="<?php echo $this->request_url; ?>" method="post" name="adminForm">
<table>
<tr>
	<td align="left" width="100%">
		<?php echo JText::_( 'Filter' ); ?>:
		<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
		<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
		<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
	</td>
	<td nowrap="nowrap">
		<?php
		//	echo $this->lists['catid'];
		//	echo $this->lists['state'];
		?>
	</td>
</tr>
</table>

<div id="editcell">
	<table class="adminlist">
	<thead>
		<tr>
			<th width="5">
				<?php echo JText::_( 'NUM' ); ?>
			</th>
			<th width="20">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
			</th>
			<th width="5%">
				<?php echo JHTML::_('grid.sort',  'Dept/Cat #', 'a.id', $this->lists['order_Dir'], $this->lists['order'] ); ?>
			</th>
			<th class="title" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',  'Dept/Cat Title', 'a.dept_cat_desc', $this->lists['order_Dir'], $this->lists['order'] ); ?>
			</th>
			<th class="title" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',  'Alias', 'a.alias', $this->lists['order_Dir'], $this->lists['order'] ); ?>
			</th>
			<th width="1%" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',  'Map', 'c.title', $this->lists['order_Dir'], $this->lists['order'] ); ?>
			</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<td colspan="9">
				<?php echo $this->pagination->getListFooter(); ?>
			</td>
		</tr>
	</tfoot>
	<tbody>
	<?php
	$k = 0;
	//var_dump($items);
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)
	{
		$row = &$this->items[$i];

		$link 	= JRoute::_( 'index.php?option=com_bookstore&controller=locator&view=locator&task=edit&id='. $row->id );
		$checked 	= JHTML::_('grid.checkedout',   $row, $i );
		?>
		<tr class="<?php echo "row$k"; ?>">
			<td>
				<?php echo $this->pagination->getRowOffset( $i ); ?>
			</td>
			<td>
				<?php echo $checked; ?>
			</td>
			<td>
				<?php echo $row->id; ?>
			</td>
			<td>
				<?php
				/*
				if (  JTable::isCheckedOut($this->user->get ('id'), $row->checked_out ) ) {
					echo $row->id;
					echo '</td><td>';
					echo $row->dept_cat_title;
					
				} else {
				*/
				?>
					<a href="<?php echo $link; ?>" title="<?php echo JText::_( 'Edit Location' ); ?>">
						<?php echo $row->dept_cat_desc; ?></a>
					</td><td>
					<a href="<?php echo $link; ?>" title="<?php echo JText::_( 'Edit Location' ); ?>">
						<?php echo $row->alias; ?></a>
					
				<?php
				//}
				?>
			</td>
			<td>
				<?php echo $row->map_title; ?>
				</a>
			</td>
		</tr>
		<?php
		$k = 1 - $k;
	}
	?>
	</tbody>
	</table>
</div>

<input type="hidden" name="controller" value="locator" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
</form>